package cn.xinfei.xdecision.datasource.mongodb;


import org.bson.types.Decimal128;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;

import java.math.BigDecimal;

/**
 * @author xiaomifeng1010
 * @version 1.0
 * @date: 2022/7/22 16:57
 * @Description mongo--->java  即mongodb中的Decimal128类型转换为为BigDecimal的转换器
 */
@ReadingConverter
public class Decimal128ToBigDecimalConverter implements Converter<Decimal128, BigDecimal> {
    @Override
    public BigDecimal convert(Decimal128 decimal128) {
//        return decimal128.bigDecimalValue();
        return decimal128.bigDecimalValue();
    }
}